Algorithmic trading with Python and Sentiment Analysis Tutorial error
Hi Harrison, I am coding along with your Quantopian series and got stuck on video 10 in the series, the one where you code the trading logic for the Sentdex data example. When I run a full backtest I get an timeout error from the fetch_csv function: "TimeoutException: Fetcher data not processed in 360 seconds There was a runtime error on line 13."
I think that this is odd, considering I get output from the log.info function call from within the fetch_csv method with the pre_func attribute. I have checked the code and it appears to be exact with yours in the video.
Any thoughts would be appreciated. Thanks!
You must be logged in to post. Please login or register an account.
# Put any initialization logic here. The context object will be passed to # the other methods in your algorithm. def preview(df): log.info(df.head()) return df
cash = context.portfolio.cash try: for s in data: if 'sentiment_signal' in data[s]: sentiment = data[s]['sentiment_signal'] current_position = context.portfolio.positions[s].amount current_price = data[s].price
if (sentiment > 5) and (current_position == 0): if cash > context.investment_size: order_value(s, context.investment_size, style = StopOrder(context.stop_loss_pct*current_price)) cash -= context.investment_size
elif (sentiment <= -1) and (current_position >0): order_target(s, 0)
except Exception as e: print(str(e))
-ABQJuan 9 years ago
You must be logged in to post. Please login or register an account.
Yep, I know what you're talking about. Equally perplexed by it. The data is indeed clearly there (as noted by the fact you can output it), but for some reason is timing out. New issue that has crept up. I tried making the file much smaller, still get the error. Something on their end it seems. It usually runs at least once out of a handful of tries. You can just skip that part though if you don't want to keep trying. We don't continue using the fetcher, luckily.
-Harrison 9 years ago
You must be logged in to post. Please login or register an account.
Ok thanks. I know this is somewhat deprecated stuff since the rollout of the pipeline api. But I thought I would gain some insight and better appreciation of pipeline by going through the tutorials. Which are great, BTW.
-ABQJuan 9 years ago
You must be logged in to post. Please login or register an account.